<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>圣杯布局</title>
  <style type="text/css">
    body{
      min-width: 550px;
    }
    #header{
      text-align: center;
      background-color: gray;
    }
    #container{
      padding-left: 200px;
      padding-right: 150px;
    }
    #container .column{
      float: left;
    }
    #center{
      background-color: goldenrod;
      width: 100%;
    }
    #left{
      background-color: greenyellow;
      position: relative;
      width: 200px;
      margin-left: -100%;
      right: 200px
    }
    #right{
      background-color: saddlebrown;
      width: 150px;
      margin-right: -150px;
    }
    #footer{
      clear: both;
      text-align: center;
      background-color: hotpink;
    }
    /* 手写 clearfix */
    /* .clearfix:after{
      content: '';
      display: table;
      clear: bath;
    } */
  </style>
</head>
<body>
  <div id="header">this is header</div>
  <!-- <div id="container" class="clearfix"> -->
  <div id="container">
    <div id="center" class="column">this is center</div>
    <div id="left" class="column">this is left</div>
    <div id="right" class="column">this is right</div>
  </div>
  <div id="footer">this is footer</div>
  
  <p>圣杯布局和双飞翼布局的目的</p>
  <ul>
    <li>三栏布局，中间一栏最先加载和渲染（内容最重要）</li>
    <li>两侧内容固定，中间内容随着宽度自适应</li>
    <li>一般用于 PC 网页</li>
  </ul>
  <p>圣杯布局和双飞翼布局的技术总结</p>
  <ul>
    <li>使用 float 布局</li>
    <li>两侧使用 margin 负值，以便和中间内容横向重叠</li>
    <li>防止中间内容被两侧覆盖，一个用 padding 一个用 margin</li>
  </ul>
</body>
</html>